package com.graduation.roombooking.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.graduation.roombooking.dto.UserDTO;
import com.graduation.roombooking.pojo.User;
import com.graduation.roombooking.vo.UnionQueryUserVo;
import com.graduation.roombooking.vo.UpdatePersonalInfo;
import com.graduation.roombooking.vo.UserVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface UserMapper extends BaseMapper<User> {

    /**
     * 根据手机号获取用户
     * @param phone
     * @return
     */
    User getUserByPhone(String phone);

    /**
     * 根据手机号获取用户的所有信息（包含部门和权限）
     * @return
     */
    UserVo getUserAllInfoByPhone(String phone);

    //web获取部门所有用户
    List<UserDTO> getListByCompanyName(String companyName);

    //web联合查询部门用户
    List<UserDTO> sysUnionQuery(UnionQueryUserVo unionQueryUserVo);

    int updateUserInfo(UpdatePersonalInfo updatePersonalInfo);

    int updateOrgUserInfo(@Param("userInfo") UpdatePersonalInfo userInfo, @Param("companyName") String companyName);

    int cancelUser(Long phone, Boolean status, String companyName);

    int addUser(User user);

    //web-非root部门联合查询本部门
    List<UserDTO> orgUnionQuery(UnionQueryUserVo unionQueryUserVo);
}
